#!/usr/bin/perl
#
# Take the ctime field and copy to the login field for all
# user records that have ctime but not login
# Logic: "must have been there when created"
#
use Counter;
use Fcntl;

$users = Counter::open(O_RDWR);

$limit = shift;
$limit = 10000 if !$limit;

@stuff = $users->select("logintime = 0 and f_ctime != 0 limit $limit");
warn @stuff + 0, " records found\n";
for $rec (@stuff) {
    $rec->{logintime} = $rec->{f_ctime};
    $rec->patch();
    ++ $patchcount;
}
warn $patchcount, " records patched\n"; 
